<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style type="text/css">
	body {background: #78bc43;}
	#c1,span {background: yellow;}
	</style>
	<script type="text/javascript">
	window.onload = function () {
		var oC = document.getElementById('c1');
		var oGC = oC.getContext('2d');
		
		oGC.beginPath();								//开始绘制
		oGC.rect(50,50,200,200);
		oGC.fill();										//填充( 画线用oGC.stroke() )

		oGC.clearRect(0, 0, oC.width, oC.height);		//擦除
	}
	</script>
</head>
<body>
	<canvas id="c1" width="600" height="400"> <!-- 宽高在这里设置 -->
		<span>不支持canvas的浏览器</span>
	</canvas>
</body>
</html>